<?php 
session_start(); 
switch ( $_GET['action'] ){ 
 
case "logout"; 
//注销登陆 
session_unset(); 
session_destroy(); 
echo "注销成功！可以判断一下密码是否正确来看看是不是成功注销"; 
break; 
case "login"; 
//写入session以供验证， 
 $_SESSION['uname']=$_GET['uname']; 
$GLOBALS['uname'] = $_SESSION['uname'];
echo "写入登陆密码了 去判断密码成功与否吧。"; 
break; 
} 

echo  "<p>_SESSION.uname=".$_SESSION['uname']."<p>";
echo  "<p>GLOBALS.uname=".$GLOBALS['uname']."<p>";

?> 
 
